package com.pingbu.tijian.hospital.backapi.api;

import com.github.pagehelper.PageInfo;
import com.pingbu.common.bean.ResultBean;
import com.pingbu.tijian.hospital.backapi.bean.entity.*;
import com.pingbu.tijian.hospital.backapi.service.BuzhiZuoyeService;
import com.pingbu.tijian.hospital.backapi.service.MessageManagerService;
import com.pingbu.tijian.hospital.backapi.service.UserInfoService;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/message_manager")
public class MessageManagerController {

    private static Logger logger = LoggerFactory.getLogger(MessageManagerController.class);

    @Autowired
    private MessageManagerService messageManagerService;

    @PostMapping(value = "/page")
    public ResultBean<PageInfo<T>> page(@RequestBody Comment param) {
        ResultBean<PageInfo<T>> rb1 = null;
        if (param.getUser_noid().equals("1")) {
            Revert revert = new Revert();
            revert.setPageNum(param.getPageNum());
            revert.setPageSize(param.getPageSize());
            rb1 = messageManagerService.page(revert);
        } else {
            rb1 = messageManagerService.page(param);
        }
        return rb1;
    }

    @PostMapping(value = "/delete")
    public ResultBean<Integer> delete(@RequestBody Comment param ) {
        ResultBean<Integer> rb1 = messageManagerService.delete(param);
        return rb1;
    }

}
